﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Summerset.Isbndb.Categories
{
    /// <summary>
    /// Represents subcategories for a <see cref="CategoryElement"/>.
    /// This information must be explicitly requested using the <see cref="CategoriesArgs.Results.subcategories"/> argument.
    /// when creating a new <see cref="CategoriesRequest"/>.
    /// </summary>
    public sealed class CategoryElementSubCategory : ResponseElementChildBase
    {
        /*
         * Element Example:
         * <SubCategory id="alphabetically.authors"/>
         */

        #region Constructor + Overridden Properties

        /// <summary>
        /// Initializes a new instance of the <see cref="CategoryElementSubCategory"/> class.
        /// </summary>
        /// <param name="element">The xml element that contains the underlying data for this instance.</param>
        public CategoryElementSubCategory(XmlElement element) 
            : base(element) { }

        /// <summary>
        /// Gets the expected name of the element that must be passed to this class' constructor.
        /// </summary>
        protected override string ExpectedElementName
        {
            get { return "SubCategory"; }
        }

        #endregion
        #region Properties

        /// <summary>
        /// Gets the ISBNdb-specific category id.
        /// </summary>
        public string CategoryId
        {
            get { return _element.Attributes["id"].Value; }
        }

        #endregion

    }
}
